import { BasicColumn } from '/@/components/Table';
import { FormSchema } from '/@/components/Table';
export const columns: BasicColumn[] = [
  {
    title: '任务ID',
    dataIndex: 'flowId',
    key: 'flowId',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '等级',
    dataIndex: 'level',
    key: 'level',
    width: 120,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '处理者',
    dataIndex: 'checker',
    key: 'checker',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '绩效',
    dataIndex: 'performance',
    key: 'performance',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '绩效原因',
    dataIndex: 'reason',
    key: 'reason',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '绩效修改',
    dataIndex: 'modifier',
    key: 'modifier',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '标题',
    dataIndex: 'title',
    key: 'title',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '发起人',
    dataIndex: 'realName',
    key: 'realName',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '处理步骤',
    dataIndex: 'actionTitle',
    key: 'actionTitle',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '状态',
    dataIndex: 'checkStatusName',
    key: 'checkStatusName',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '处理时间',
    dataIndex: 'checkDate',
    key: 'checkDate',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
  {
    title: '流程类型',
    dataIndex: 'typeName',
    key: 'typeName',
    width: 100,
    ellipsis: true,
    resizable: true,
  },
];

export const setDisabled = (data) => {
  data.forEach((item) => {
    item.label = item.name;
    item.value = item.code;
    item.key = item.code;
    if (item.children && item.children.length > 0) {
      item.disabled = true;
      setDisabled(item.children);
    }
  });
  return data;
};

export const searchFormSchema: FormSchema[] = [
  {
    field: 'typeCode',
    label: '流程类型',
    component: 'TreeSelect',
    colProps: { span: 4 },
    slots: 'typeCode',
  },
  {
    field: 'title',
    label: '标题',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'idcard',
    label: 'ID号',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'fqr',
    label: '发起人',
    component: 'Input',
    colProps: { span: 4 },
  },
  {
    field: 'isOver',
    label: '工作状态',
    component: 'Select',
    colProps: { span: 4 },
    componentProps: {
      options: [
        {
          value: '1',
          label: '处理中',
        },
        {
          value: '2',
          label: '已结束',
        },
        {
          value: '0',
          label: '未提交',
        },
        {
          value: '-2',
          label: '已拒绝',
        },
      ],
      getPopupContainer: () => document.body,
    },
  },
];
